//路由模块
const express = require('express')
const router = express.Router()

//编写get接口
router.get('/get',(req,res)=>{
    //1.获取请求参数，应该是查询字符串格式
    const query = req.query
    //响应客户端
    res.send({
        status:0,
        msg:'GET请求成功',
        data:query
    })
})
router.get('/getList',(req,res)=>{
    //1.获取请求参数，应该是查询字符串格式
    const query = req.query
    //响应客户端
    res.send({
        status:0,
        msg:'GET请求成功',
        data:{
            pageNum:1,
            pageSize:10,
            list:[1,2,3,4,5,6,7,8,9,10]
        }
    })
})

//编写post接口
router.post('/post',(req,res)=>{
    const body = req.body
    res.send({
        status:0,
        msg:'post请求成功',
        data:body
    })
})

module.exports = router